﻿<Window x:Class="Bricks.BaseFramework.GenericForms.MsgBoxWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="None" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" KeyUp="Window_KeyUp">
    <Window.Resources>
        <!--普通通用按钮基础属性：包含ControlTemplate：测试-->
        <Style TargetType="{x:Type Button}" x:Key="CommonButton">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Margin" Value="3" />
            <Setter Property="Width" Value="60" />
            <Setter Property="Height" Value="26" />            
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle RadiusY="3" RadiusX="3" Stroke="#FFA9CEF8">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFE9EDF3" Offset="0" />
                                        <GradientStop Color="White" Offset="1" />
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <TextBlock Text="{TemplateBinding Button.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <!--不启用状态-->
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type Button}">
                                <Grid>
                                    <Rectangle x:Name="rectangle1" RadiusY="3" RadiusX="3" Stroke="#FFA9CEF8">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFE9EDF3" Offset="0" />
                                                <GradientStop Color="White" Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <TextBlock Text="{TemplateBinding Button.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Cursor" Value="None"/>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type Button}">
                                <Grid>
                                    <Rectangle x:Name="rectangle1" RadiusY="3" RadiusX="3" Stroke="#FFA9CEF8">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFE2E7EF" Offset="0" />
                                                <GradientStop Color="GhostWhite" Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <TextBlock Text="{TemplateBinding Button.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type Button}">
                                <Grid>
                                    <Rectangle x:Name="rectangle1" RadiusY="4" RadiusX="4" Stroke="#FFA9CEF8">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFCBCBD1" Offset="0" />
                                                <GradientStop Color="GhostWhite" Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <TextBlock Text="{TemplateBinding Button.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid Name="gridMain">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#E6D3ECF9" Offset="0.033" />
                <GradientStop Color="#F3F6FAFD" Offset="1" />
                <GradientStop Color="#FFEDF3F6" Offset="0.431" />
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Border Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Name="border1" VerticalAlignment="Stretch" Grid.RowSpan="4" BorderBrush="#FF007BDA" CornerRadius="2" BorderThickness="1"></Border>
        <Grid HorizontalAlignment="Stretch" Name="gridTop" VerticalAlignment="Stretch" Grid.ColumnSpan="2" MouseLeftButtonDown="gridTop_MouseLeftButtonDown">
            <!--背景颜色请在下方的Style中修改-->
            <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                    <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="True">
                            <Setter Property="Background" Value="#40007BF9" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="#58007BF9" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="207*" />
            </Grid.ColumnDefinitions>
            <TextBlock HorizontalAlignment="Left" Name="txtTitle" Text="提示标题" VerticalAlignment="Top" Margin="12,6" />
            <!--Button大小设置为0*0 IsCancel=true，快捷键ESC生效-->
            <Button Content="X" HorizontalAlignment="Right" Name="btnClose" VerticalAlignment="Top" Grid.Column="1" Width="0" Height="0" Margin="0,5,5,0" IsCancel="True">
                <!--<Button.Style>
                    <Style TargetType="{x:Type Button}">
                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                        <Setter Property="Cursor" Value="Hand"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type Button}">
                                    <Grid>
                                        <Image Source="/BaseFramework;component/UI/Images/GenericForms/MsgBox/msgbox_close.png" />
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Grid>
                                                <Image Source="/BaseFramework;component/UI/Images/GenericForms/MsgBox/msgbox_close_over.png" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Grid>
                                                <Image Source="/BaseFramework;component/UI/Images/GenericForms/MsgBox/msgbox_close.png" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>-->
            </Button>

        </Grid>
        <Image Grid.Row="1" HorizontalAlignment="Center" Margin="20,12,15,5" Name="imgIcon" Stretch="Fill" Width="32" Height="32" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
            <!--旋转效果-->
            <!--<Image.RenderTransform>
                <RotateTransform x:Name="gearRotateTransform" Angle="0"/>
            </Image.RenderTransform>
            <Image.Triggers>
                <EventTrigger RoutedEvent="Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation 
                                Storyboard.TargetName="gearRotateTransform" 
                                Storyboard.TargetProperty="Angle"
                                From="0" To="360" Duration="00:00:10" RepeatBehavior="Forever"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>-->
        </Image>
        <TextBlock Grid.Row="1" HorizontalAlignment="Left" Margin="0,16,20,0" Name="txtMessage" VerticalAlignment="Top" TextWrapping="WrapWithOverflow" Grid.ColumnSpan="2" Grid.Column="1" Text="注意：提示文字说明，请使用\n换行" />
        <StackPanel Grid.ColumnSpan="2" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" Name="stackPanel1" VerticalAlignment="Stretch" Orientation="Horizontal" Margin="5,8,5,10">
            <Button Content="是(Y)" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center" Name="btnYes" VerticalAlignment="Center" Margin="3,0,3,5" Click="btnYes_Click" Visibility="Collapsed" IsDefault="True" Width="56" Style="{StaticResource CommonButton}" />
            <Button Content="否(N)" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center" Name="btnNo" VerticalAlignment="Center" Margin="3,0,3,5" Click="btnNo_Click" Visibility="Collapsed" Width="56" Style="{StaticResource CommonButton}" />
            <Button Content="确定" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center" Name="btnOK" VerticalAlignment="Center" Margin="3,0,3,5" Click="btnOK_Click" Visibility="Collapsed" IsDefault="True" Style="{StaticResource CommonButton}" />
            <Button Content="取消" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center" Name="btnCancel" VerticalAlignment="Center" Margin="3,0,3,5" Visibility="Collapsed" Click="btnCancel_Click" Style="{StaticResource CommonButton}" />
        </StackPanel>
    </Grid>
</Window>
